home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 November: Tool Chest / Dev.CD Nov 96 TC / Dev.CD Nov 96 TC.toast / Sample Code / QuickTime / JPEG Sample / Headers / App.h next >
Encoding:
C/C++ Source or Header  |  1996-05-22  |  4.4 KB  |  187 lines  |  [TEXT/MPCC]

  1. /*************************************************************************************
  2. #
  3. #        App.h
  4. #
  5. #        This file contains the constants and structure definitions.
  6. #
  7. #        Author(s):     Michael Marinkovich & Guillermo Ortiz
  8. #                    Apple Developer Technical Support
  9. #                    marink@apple.com
  10. #
  11. #        Modification History: 
  12. #
  13. #            4/3/96        MWM     Initial coding                     
  14. #
  15. #        Copyright © 1992-96 Apple Computer, Inc., All Rights Reserved
  16. #
  17. #
  18. #        You may incorporate this sample code into your applications without
  19. #        restriction, though the sample code has been provided "AS IS" and the
  20. #        responsibility for its operation is 100% yours.  However, what you are
  21. #        not permitted to do is to redistribute the source as "DSC Sample Code"
  22. #        after having made changes. If you're going to re-distribute the source,
  23. #        we require that you make it clear in the source that the code was
  24. #        descended from Apple Sample Code, but that you've made changes.
  25. #
  26. *************************************************************************************/
  27.  
  28. #include <QDOffscreen.h>
  29.  
  30.  
  31. //---------------------------------------------------------------------
  32. //
  33. //    Macros
  34. //
  35. //---------------------------------------------------------------------
  36.  
  37. #define MIN(x,y)            ( ((x)<(y)) ? (x) : (y) )
  38. #define MAX(x,y)            ( ((x)>(y)) ? (x) : (y) )
  39. #define TopLeft( r )        ( *(Point *) &(r).top )
  40. #define BotRight( r )        ( *(Point *) &(r).bottom )
  41.  
  42.  
  43. //---------------------------------------------------------------------
  44. //
  45. //    General
  46. //
  47. //---------------------------------------------------------------------
  48.  
  49. #define kMinHeap            300 * 1024
  50. #define kMinSpace            300 * 1024
  51.  
  52.  
  53. //---------------------------------------------------------------------
  54. //
  55. //    Menus
  56. //
  57. //---------------------------------------------------------------------
  58.  
  59. #define rMBarID                128
  60.  
  61. enum {
  62.      mApple                    = 128,
  63.     iAbout                    = 1,
  64.  
  65.     mFile                    = 129,
  66.     iNew                    = 1,
  67.     iOpen                    = 2,
  68.     iSave                    = 3,
  69.     iClose                    = 4,
  70.     iQuit                    = 6
  71. };
  72.  
  73.  
  74. //---------------------------------------------------------------------
  75. //
  76. //    Window stuff
  77. //
  78. //---------------------------------------------------------------------
  79.  
  80. // doc types
  81. enum {
  82.     kDocKind                = 94,
  83.     kDialogKind                = 95,
  84.     kFloatKind                = 96,
  85.     kAboutKind                = 97
  86. };    
  87.  
  88. #define kFudgeFactor        4        // fudge factor for boundary around window
  89. #define kTitleBarHeight        18        // title bar height
  90.  
  91. // scroll values
  92. #define kScrollWidth        15
  93. #define kScrollDelta        16
  94.  
  95.  
  96. //---------------------------------------------------------------------
  97. //
  98. //    General resource ID's
  99. //
  100. //---------------------------------------------------------------------
  101.  
  102. #define rAboutPictID        3000 // about picture
  103. #define rErrorDlg            128     // main error dialog
  104.  
  105.  
  106. //---------------------------------------------------------------------
  107. //
  108. //    Alert Error ID's
  109. //
  110. //---------------------------------------------------------------------
  111.  
  112. #define kNeedsDisplayManager        128    // ID of no Display Manager
  113.  
  114.  
  115. //---------------------------------------------------------------------
  116. //
  117. //    Custom Event Proc stuff
  118. //
  119. //---------------------------------------------------------------------
  120.  
  121. enum {
  122.     kIdleProc            = 1,
  123.     kMenuProc,
  124.     kInContentProc,
  125.     kInGoAwayProc,
  126.     kInZoomProc,
  127.     kInGrowProc,
  128.     kMUpProc,
  129.     kKeyProc,
  130.     kActivateProc,
  131.     kUpdateProc
  132. };
  133.     
  134.  
  135. //---------------------------------------------------------------------
  136. //
  137. //    Typedefs
  138. //
  139. //---------------------------------------------------------------------
  140.  
  141. // event handling proc
  142. typedef void (*CustomProc)(WindowRef window, void *refCon);
  143.  
  144.  
  145. // we just use the basic events for the callback procs
  146.  
  147. struct DocRec
  148. {    
  149.     CustomProc                    idleProc;            // custom idle proc
  150.     CustomProc                    mMenuProc;            // custom menu proc
  151.     CustomProc                    inContentProc;        // custom content click Proc
  152.     CustomProc                    inGoAwayProc;        // custom inGoAway proc
  153.     CustomProc                    inZoomProc;            // custom inZoom proc
  154.     CustomProc                    inGrowProc;            // custom inGrow proc
  155.     CustomProc                    mUpProc;            // custom mouseUp proc
  156.     CustomProc                    keyProc;            // custom autoKey-keyDown proc
  157.     CustomProc                    activateProc;        // custom activate window proc
  158.     CustomProc                    updateProc;            // custom window update proc
  159.     ControlRef                    hScroll;            // horz scroll bar
  160.     ControlRef                    vScroll;            // vert scroll bar
  161.     GWorldPtr                    world;                // offscreen for pict imaging
  162.     PicHandle                    pict;                // windows picture
  163.     THPrint                        printer;            // apps print record - inited at window int
  164.     Boolean                        dirty;                // document needs saving
  165. };
  166.  
  167. typedef struct DocRec DocRec;
  168. typedef DocRec *DocPtr, **DocHnd;
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.